import {createRouter, createWebHistory} from 'vue-router'
// 1. 导入页面组件（按需调整路径，确保文件存在）
import Home from './cfpages/Home.vue'
import NotFound from './cfpages/404.vue'


const routes = [
    // 2. 根路径：跳转或直接显示首页
    {
        path: '/',
        redirect: '/home' // 可选：重定向到首页；也可直接 component: Home
    },
    {
        path: '/home',
        component: Home
    },

    {
        path: '/user',
        component: () => import('./cfpages/user/User.vue')
    },
    {
        path: '/order',
        component: () => import('./cfpages/order/Order.vue')
    },
    {
        path: '/behavior',
        component: () => import('./cfpages/behavior/Behavior.vue')
    },
    {
        path: '/comment',
        component: () => import('./cfpages/comment/Comment.vue')
    },
    {
        path: '/logistics',
        component: () => import('./cfpages/logistics/Logistics.vue')
    },
    {
        path: '/merchant',
        component: () => import('./cfpages/merchant/Merchant.vue')
    },
    {
        path: '/product',
        component: () => import('./cfpages/product/Product.vue')
    },
    {
        path: '/promotion',
        component: () => import('./cfpages/promotion/Promotion.vue')
    },
    {
        path: '/staff',
        component: () => import('./cfpages/staff/Staff.vue')
    },
    {
        path: '/support',
        component: () => import('./cfpages/support/Support.vue')
    },
    {
        path: '/:pathMatch(.*)*',
        component: NotFound
    }
]


const router = createRouter({
    history: createWebHistory(), // HTML5 History 模式
    routes,
})

export default router